{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "68db3db5",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0e5c958",
   "metadata": {},
   "source": [
    "# 缺失值处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2ac7e1d6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Rank</th>\n",
       "      <th>Title</th>\n",
       "      <th>Genre</th>\n",
       "      <th>Description</th>\n",
       "      <th>Director</th>\n",
       "      <th>Actors</th>\n",
       "      <th>Year</th>\n",
       "      <th>Runtime (Minutes)</th>\n",
       "      <th>Rating</th>\n",
       "      <th>Votes</th>\n",
       "      <th>Revenue (Millions)</th>\n",
       "      <th>Metascore</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Guardians of the Galaxy</td>\n",
       "      <td>Action,Adventure,Sci-Fi</td>\n",
       "      <td>A group of intergalactic criminals are forced ...</td>\n",
       "      <td>James Gunn</td>\n",
       "      <td>Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...</td>\n",
       "      <td>2014</td>\n",
       "      <td>121</td>\n",
       "      <td>8.1</td>\n",
       "      <td>757074</td>\n",
       "      <td>333.13</td>\n",
       "      <td>76.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Prometheus</td>\n",
       "      <td>Adventure,Mystery,Sci-Fi</td>\n",
       "      <td>Following clues to the origin of mankind, a te...</td>\n",
       "      <td>Ridley Scott</td>\n",
       "      <td>Noomi Rapace, Logan Marshall-Green, Michael Fa...</td>\n",
       "      <td>2012</td>\n",
       "      <td>124</td>\n",
       "      <td>7.0</td>\n",
       "      <td>485820</td>\n",
       "      <td>126.46</td>\n",
       "      <td>65.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Split</td>\n",
       "      <td>Horror,Thriller</td>\n",
       "      <td>Three girls are kidnapped by a man with a diag...</td>\n",
       "      <td>M. Night Shyamalan</td>\n",
       "      <td>James McAvoy, Anya Taylor-Joy, Haley Lu Richar...</td>\n",
       "      <td>2016</td>\n",
       "      <td>117</td>\n",
       "      <td>7.3</td>\n",
       "      <td>157606</td>\n",
       "      <td>138.12</td>\n",
       "      <td>62.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Sing</td>\n",
       "      <td>Animation,Comedy,Family</td>\n",
       "      <td>In a city of humanoid animals, a hustling thea...</td>\n",
       "      <td>Christophe Lourdelet</td>\n",
       "      <td>Matthew McConaughey,Reese Witherspoon, Seth Ma...</td>\n",
       "      <td>2016</td>\n",
       "      <td>108</td>\n",
       "      <td>7.2</td>\n",
       "      <td>60545</td>\n",
       "      <td>270.32</td>\n",
       "      <td>59.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Suicide Squad</td>\n",
       "      <td>Action,Adventure,Fantasy</td>\n",
       "      <td>A secret government agency recruits some of th...</td>\n",
       "      <td>David Ayer</td>\n",
       "      <td>Will Smith, Jared Leto, Margot Robbie, Viola D...</td>\n",
       "      <td>2016</td>\n",
       "      <td>123</td>\n",
       "      <td>6.2</td>\n",
       "      <td>393727</td>\n",
       "      <td>325.02</td>\n",
       "      <td>40.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Rank                    Title                     Genre  \\\n",
       "0     1  Guardians of the Galaxy   Action,Adventure,Sci-Fi   \n",
       "1     2               Prometheus  Adventure,Mystery,Sci-Fi   \n",
       "2     3                    Split           Horror,Thriller   \n",
       "3     4                     Sing   Animation,Comedy,Family   \n",
       "4     5            Suicide Squad  Action,Adventure,Fantasy   \n",
       "\n",
       "                                         Description              Director  \\\n",
       "0  A group of intergalactic criminals are forced ...            James Gunn   \n",
       "1  Following clues to the origin of mankind, a te...          Ridley Scott   \n",
       "2  Three girls are kidnapped by a man with a diag...    M. Night Shyamalan   \n",
       "3  In a city of humanoid animals, a hustling thea...  Christophe Lourdelet   \n",
       "4  A secret government agency recruits some of th...            David Ayer   \n",
       "\n",
       "                                              Actors  Year  Runtime (Minutes)  \\\n",
       "0  Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...  2014                121   \n",
       "1  Noomi Rapace, Logan Marshall-Green, Michael Fa...  2012                124   \n",
       "2  James McAvoy, Anya Taylor-Joy, Haley Lu Richar...  2016                117   \n",
       "3  Matthew McConaughey,Reese Witherspoon, Seth Ma...  2016                108   \n",
       "4  Will Smith, Jared Leto, Margot Robbie, Viola D...  2016                123   \n",
       "\n",
       "   Rating   Votes  Revenue (Millions)  Metascore  \n",
       "0     8.1  757074              333.13       76.0  \n",
       "1     7.0  485820              126.46       65.0  \n",
       "2     7.3  157606              138.12       62.0  \n",
       "3     7.2   60545              270.32       59.0  \n",
       "4     6.2  393727              325.02       40.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 读取电影数据\n",
    "movie = pd.read_csv(\"./data/IMDB-Movie-Data.csv\")\n",
    "movie.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b4699dbb",
   "metadata": {},
   "source": [
    "## 缺失值为nan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "17b36db9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1.判断是否存在nan的缺失值\n",
    "pd.notnull(movie)   #movie中非nan为true  但几百万的数据，肉眼无法判断是否存在ｆａｌｓｅ\n",
    "np.all(pd.notnull(movie)) #np.all() 一假即为假\n",
    "\n",
    "pd.isnull(movie)\n",
    "np.any(pd.isnull(movie)) #np.any(）一真即为真\n",
    "\n",
    "\n",
    "#2.处理缺失值\n",
    "# 2.1删除缺失值\n",
    "nonan_movie = movie.dropna()\n",
    "np.any(pd.isnull(nonan_movie))   #==>返回False代表无缺失值\n",
    "\n",
    "# 2.2替换缺失值\n",
    "#指定列替换\n",
    "pd.isnull(movie[\"Runtime (Minutes)\"])\n",
    "movie[\"Runtime (Minutes)\"].fillna(movie[\"Runtime (Minutes)\"].mean() ,inplace=True)\n",
    "np.any(pd.isnull(movie[\"Runtime (Minutes)\"]))\n",
    "\n",
    "\n",
    "np.any(pd.isnull(movie))#==>返回True，代表仍有nan值\n",
    "#指多列填充\n",
    "for i in movie.columns:\n",
    "    #如果存在空值列\n",
    "    if np.all(pd.notnull(movie[i])) == False:\n",
    "        #nan值进行替换\n",
    "        movie[i].fillna(movie[i].mean() ,inplace=True)\n",
    "        \n",
    "np.all(pd.notnull(movie))        "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b7e68aa0",
   "metadata": {},
   "source": [
    "## 缺失值不是nan标记的处理⽅式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4eeb6b93",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>1000025</th>\n",
       "      <th>5</th>\n",
       "      <th>1</th>\n",
       "      <th>1.1</th>\n",
       "      <th>1.2</th>\n",
       "      <th>2</th>\n",
       "      <th>1.3</th>\n",
       "      <th>3</th>\n",
       "      <th>1.4</th>\n",
       "      <th>1.5</th>\n",
       "      <th>2.1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1002945</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1015425</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1016277</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1017023</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1017122</td>\n",
       "      <td>8</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   1000025  5   1  1.1  1.2  2 1.3  3  1.4  1.5  2.1\n",
       "0  1002945  5   4    4    5  7  10  3    2    1    2\n",
       "1  1015425  3   1    1    1  2   2  3    1    1    2\n",
       "2  1016277  6   8    8    1  3   4  3    7    1    2\n",
       "3  1017023  4   1    1    3  2   1  3    1    1    2\n",
       "4  1017122  8  10   10    8  7  10  9    7    1    4"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wis = pd.read_csv(\"https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data\")\n",
    "wis.head()\n",
    "\n",
    "# 把⼀些其它值标记的缺失值，替换成np.nan\n",
    "wis = wis.replace(to_replace='?', value=np.nan)\n",
    "wis.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a17ea7cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>1000025</th>\n",
       "      <th>5</th>\n",
       "      <th>1</th>\n",
       "      <th>1.1</th>\n",
       "      <th>1.2</th>\n",
       "      <th>2</th>\n",
       "      <th>1.3</th>\n",
       "      <th>3</th>\n",
       "      <th>1.4</th>\n",
       "      <th>1.5</th>\n",
       "      <th>2.1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1002945</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1015425</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1016277</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1017023</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1017122</td>\n",
       "      <td>8</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>693</th>\n",
       "      <td>776715</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>694</th>\n",
       "      <td>841769</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>695</th>\n",
       "      <td>888820</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>3</td>\n",
       "      <td>8</td>\n",
       "      <td>10</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>696</th>\n",
       "      <td>897471</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>6</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>697</th>\n",
       "      <td>897471</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>682 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     1000025  5   1  1.1  1.2  2 1.3   3  1.4  1.5  2.1\n",
       "0    1002945  5   4    4    5  7  10   3    2    1    2\n",
       "1    1015425  3   1    1    1  2   2   3    1    1    2\n",
       "2    1016277  6   8    8    1  3   4   3    7    1    2\n",
       "3    1017023  4   1    1    3  2   1   3    1    1    2\n",
       "4    1017122  8  10   10    8  7  10   9    7    1    4\n",
       "..       ... ..  ..  ...  ... ..  ..  ..  ...  ...  ...\n",
       "693   776715  3   1    1    1  3   2   1    1    1    2\n",
       "694   841769  2   1    1    1  2   1   1    1    1    2\n",
       "695   888820  5  10   10    3  7   3   8   10    2    4\n",
       "696   897471  4   8    6    4  3   4  10    6    1    4\n",
       "697   897471  4   8    8    5  4   5  10    4    1    4\n",
       "\n",
       "[682 rows x 11 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wis.dropna()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd9c424b",
   "metadata": {},
   "source": [
    "# 数据离散化"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a4c4c752",
   "metadata": {},
   "source": [
    "数据离散化【知道】\n",
    "　可以⽤来减少给定连续属性值的个数（连续型数据转化为离散型数据＝＝＞多个对象转换为少个对象）\n",
    "　在连续属性的值域上，将值域划分为若⼲个离散的区间，最后⽤不同的符号或整数值代表落在每个⼦区间中的属性值。\n",
    "qcut、cut实现数据分组【知道】\n",
    "qcut:⼤致分为距离相同的⼏组 ＞pd.qcut(data=Series对象, 分的组数)：将数据分组，⼀般与value_counts搭配使⽤，统计每组的个数\n",
    "cut:⾃定义分组区间         >pd.cut(data, bins) bins=[自己指定的分组区间]\n",
    "get_dummies实现哑变量矩阵【知道】"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "866c2c99",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2018-02-27    (1.738, 2.938]\n",
       " 2018-02-26     (2.938, 5.27]\n",
       " 2018-02-23    (1.738, 2.938]\n",
       " 2018-02-22     (0.94, 1.738]\n",
       " 2018-02-14    (1.738, 2.938]\n",
       " Name: p_change, dtype: category\n",
       " Categories (10, interval[float64, right]): [(-10.030999999999999, -4.836] < (-4.836, -2.444] < (-2.444, -1.352] < (-1.352, -0.462] ... (0.94, 1.738] < (1.738, 2.938] < (2.938, 5.27] < (5.27, 10.03]],\n",
       " 2018-02-27      (0, 3]\n",
       " 2018-02-26      (3, 5]\n",
       " 2018-02-23      (0, 3]\n",
       " 2018-02-22      (0, 3]\n",
       " 2018-02-14      (0, 3]\n",
       " 2018-02-13      (0, 3]\n",
       " 2018-02-12      (3, 5]\n",
       " 2018-02-09    (-7, -5]\n",
       " 2018-02-08      (0, 3]\n",
       " 2018-02-07     (-3, 0]\n",
       " Name: p_change, dtype: category\n",
       " Categories (8, interval[int64, right]): [(-100, -7] < (-7, -5] < (-5, -3] < (-3, 0] < (0, 3] < (3, 5] < (5, 7] < (7, 100]])"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"./data/stock_day.csv\")\n",
    "p_change= data['p_change']\n",
    "p_change\n",
    "\n",
    "# 股票涨跌幅数据进⾏分组\n",
    "# 分成大小差不多的10组数据\n",
    "qcut_data=pd.qcut(p_change,10)\n",
    "qcut_data.value_counts()\n",
    "\n",
    "# 指定分组区间\n",
    "bins = [-100, -7, -5, -3, 0, 3, 5, 7, 100]\n",
    "cut_data = pd.cut(p_change, bins)\n",
    "cut_data.value_counts()\n",
    "\n",
    "\n",
    "# 分组数据变成one-hot编码\n",
    "# 把每个类别⽣成⼀个布尔列，这些列中只有⼀列可以为这个样本取值为1.其⼜被称为独热编码。\n",
    "# pandas.get_dummies(data＝array-like, Series, or DataFrame, prefix=分组名字前缀，默认为Ｎone)\n",
    "dummies = pd.get_dummies(data=cut_data ,prefix=Ｎone)\n",
    "dummies\n",
    "qcut_data[:5],cut_data[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5597492c",
   "metadata": {},
   "source": [
    "# 合并"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "20f9eddb",
   "metadata": {},
   "source": [
    "pd.concat([数据1, 数据2], axis=**)【知道】\n",
    "pd.merge(left, right, how=, on=)【知道】\n",
    "how -- 以何种⽅式连接\n",
    "on -- 连接的键的依据是哪⼏个"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "8d2ff734",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>K0</td>\n",
       "      <td>K1</td>\n",
       "      <td>A1</td>\n",
       "      <td>B1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>K2</td>\n",
       "      <td>K1</td>\n",
       "      <td>A3</td>\n",
       "      <td>B3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  key1 key2   A   B    C    D\n",
       "0   K0   K0  A0  B0   C0   D0\n",
       "1   K0   K1  A1  B1  NaN  NaN\n",
       "2   K1   K0  A2  B2   C1   D1\n",
       "3   K1   K0  A2  B2   C2   D2\n",
       "4   K2   K1  A3  B3  NaN  NaN"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#concat([data1,data2],axis=1_列数变多即扩展，0_行数变多即追加)\n",
    "con_0 = pd.concat([qcut_data[:5],cut_data[:10]],axis=0)\n",
    "con_1 = pd.concat([qcut_data[:5],cut_data[:10]],axis=1)\n",
    "\n",
    "con_0,con_1\n",
    "\n",
    "#pd.merge(data1, data2, how=联接方式，包含[inner,left,right,outer], on=共同键)\n",
    "data1 = pd.DataFrame({'key1': ['K0', 'K0', 'K1', 'K2'],\n",
    "                     'key2': ['K0', 'K1', 'K0', 'K1'],\n",
    "                     'A': ['A0', 'A1', 'A2', 'A3'],\n",
    "                     'B': ['B0', 'B1', 'B2', 'B3']})\n",
    "data2 = pd.DataFrame({'key1': ['K0', 'K1', 'K1', 'K2'],\n",
    "                      'key2': ['K0', 'K0', 'K0', 'K0'],\n",
    "                      'C': ['C0', 'C1', 'C2', 'C3'],\n",
    "                      'D': ['D0', 'D1', 'D2', 'D3']})\n",
    "# 默认内连接\n",
    "result = pd.merge(data1, data2, on=['key1', 'key2'])\n",
    "# 左连接\n",
    "result = pd.merge(data1, data2, how='left', on=['key1', 'key2'])\n",
    "# # 右连接\n",
    "result = pd.merge(data1, data2, how='right', on=['key1', 'key2'])\n",
    "# # 外链接\n",
    "result = pd.merge(data1, data2, how='outer', on=['key1', 'key2'])\n",
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f1d3a343",
   "metadata": {},
   "source": [
    "# 交叉表与透视表"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "302e5392",
   "metadata": {},
   "source": [
    "交叉表：交叉表⽤于计算⼀列数据对于另外⼀列数据的分组个数(⽤于统计分组频率的特殊透视表)\n",
    "pd.crosstab(value1, value2)\n",
    "\n",
    "透视表：透视表是将原有的DataFrame的列分别作为⾏索引和列索引，然后对指定的列应⽤聚集函数\n",
    "data.pivot_table(）\n",
    "DataFrame.pivot_table([数据], index=[分类项])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "2115b00a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 寻找星期⼏跟股票张得的关系\n",
    "\n",
    "# 交叉表:pd.crosstab(value1, value2)\n",
    "# 1、先把对应的⽇期找到星期⼏\n",
    "date = pd.to_datetime(data.index).weekday\n",
    "data['week'] = date\n",
    "data\n",
    "\n",
    "# 2、假如把p_change按照⼤⼩去分个类0为界限\n",
    "data[\"pc_label\"]=np.where(data[\"p_change\"]>0,1,0)\n",
    "data.head()\n",
    "\n",
    "# 3.通过交叉表找寻两列数据的关系\n",
    "label_count=pd.crosstab(data['week'],data[\"pc_label\"])\n",
    "label_count\n",
    "\n",
    "# 3.转化为占比\n",
    "week_sum = label_count.sum(axis=1)\n",
    "label_rate = label_count.div(week_sum,axis=0)\n",
    "\n",
    "# 绘制\n",
    "import matplotlib.pylab as plt\n",
    "\n",
    "label_rate.plot(kind = \"bar\" ,stacked=\"True\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "6d1b5a87",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEDCAYAAAAlRP8qAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAQLUlEQVR4nO3df6zddX3H8ecL2tpNkEV6Mdrb2pJWXEEjckGZkeHEUbql/DG2tMnGEGezhE4XnRGjQcO2BLZMMyfbbIZzEqGr/DGaraMjCkoUtOWHTGCVCmhvdVorYhzWUnzvj3uwx8tt7yn39J7bz30+kobz/Xw/5/N932/oq5/7Od/v96SqkCQd+44bdAGSpP4w0CWpEQa6JDXCQJekRhjoktQIA12SGjFnUAdesGBBLVmyZFCHl6Rj0j333PP9qhqaaN/AAn3JkiVs3759UIeXpGNSkm8eap9LLpLUCANdkhphoEtSIwa2hi5Jg/L0008zOjrKvn37Bl3KIc2fP5/h4WHmzp3b83sMdEmzzujoKCeeeCJLliwhyaDLeY6qYu/evYyOjrJ06dKe3zfpkkuSTyT5XpKvHWJ/knw0yc4kDyR57RHULUnTbt++fZx88skzMswBknDyyScf8W8QvayhfxJYeZj9FwHLO3/WAf9wRBVI0gDM1DB/1vOpb9JAr6ovAD84TJeLgU/VmLuBX0ny0iOuRJJmkVtvvZXTTju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/36XYyAvZ3yB/VJVtyZ5BWOPA+7+UHRbZ1Yy2/w7cMKzQdYtyR3TXs3gXAoc6G6oqgPApUk+PpiSBua8qvop/DzQnjWXg4/2mFU6T5D93SS/Bfxo0PVMZtasoUtS67wOXZIaYaBLUiMMdOkIJbkjyYz+ogPNTga6JDXCQFfzkrync0coST6S5HOd17+R5NNJfjPJXUnuTfKZJCd09p+V5PNJ7kmyNclLx417XJJPJvmL6f+ppOcy0DUb3Am8sfN6BDghydxO2wPAB4ALOrf5bwfe1dn/d8AlVXUWY9eld9/6Pgf4NPBIVX1gen4M6fBmzXXomtXuAc5K8iLgp8C9jAX7Gxn7+sQVwBeTAMwD7gJOA84Abuu0Hw98p2vMjwObZtPzTTTzGehqXlU9neQx4DLG7oJ9gLEHLS0DHgNuq6q13e9J8irGnvFz7iGG/RLwpiR/U1X7jlrx0hFwyUWzxZ3AnwFf6Lz+Y+A+4G7gDUmWASR5YeeO4h3AUJJzO+1zk5zeNd71wBZgUxInRpoRDHTNFncy9iC2u6rqu8A+4M6q2sPYzP2mzgPL7gJeWVX7gUuAa5N8Fbgf+LXuAavqw4z9o3BDEv8uaeC89V+SGuGsQpIaYaBLUiMMdElqhIEuSY0w0CWpEQa6JDXCQJekRhjoktSI/wdv5gyb0e37xQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 透视表:data.pivot_table(统计数据，index=分类项） 或　DataFrame.pivot_table(数据，index=分类项)\n",
    "pivot_table = data.pivot_table(['pc_label'], index='week')\n",
    "pivot_table[\"0\"]=pivot_table[\"pc_label\"]\n",
    "pivot_table[\"1\"]=1-pivot_table[\"pc_label\"]\n",
    "pivot_table =pivot_table[[\"0\",\"1\"]]\n",
    "pivot_table\n",
    "# 绘制\n",
    "import matplotlib.pylab as plt\n",
    "\n",
    "pivot_table.plot(kind = \"bar\" ,stacked=\"True\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e43037b8",
   "metadata": {},
   "source": [
    "# 分组与聚合"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "908415ea",
   "metadata": {},
   "source": [
    "DataFrame.groupby(key=分组的列数据　可以多个, as_index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "9d7c5e0f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(color  object \n",
       " green  pen        2.75\n",
       "        pencil     1.30\n",
       " red    ashtray    0.56\n",
       "        pencil     4.20\n",
       " white  pen        5.56\n",
       " Name: price1, dtype: float64,\n",
       " color\n",
       " green    2.025\n",
       " red      2.380\n",
       " white    5.560\n",
       " Name: price1, dtype: float64)"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col =pd.DataFrame({'color': ['white','red','green','red','green'], 'object': ['pen','pencil','pencil','ashtray','pen'],'price1':[5.56,4.20,1.30,0.56,2.75],'price2':[4.75,4.12,1.60,0.75,3.15]})\n",
    "col.head()\n",
    "\n",
    "# 不同颜⾊的不同笔的价格1汇总\n",
    "kinds_price =col.groupby([\"color\",\"object\"])[\"price1\"].mean()\n",
    "color_price = col[\"price1\"].groupby(col[\"color\"]).mean()\n",
    "kinds_price,color_price\n",
    "# 注意两种写法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f55abad8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "247.333px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
